﻿Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Reflection
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Imports System.Threading
Imports System.Workflow.ComponentModel
Imports System.Workflow.ComponentModel.Compiler
Imports System.Workflow.ComponentModel.Design

Namespace System.Workflow.Activities
    Friend Class WebServiceActivityHelpers
        ' Methods
        Private Shared Function FindLeastCommonParent(ByVal source As IEnumerable([Of] String), ByVal dest As IEnumerable([Of] String)) As String
            Dim enumerator As IEnumerator = source.GetEnumerator
            Dim enumerator2 As IEnumerator = dest.GetEnumerator
            Dim current As String = Nothing
            Do While (enumerator.MoveNext AndAlso enumerator2.MoveNext)
                If enumerator.Current.Equals(enumerator2.Current) Then
                    current = CStr(enumerator.Current)
                Else
                    Return current
                End If
            Loop
            Return current
        End Function

        Private Shared Function GetActivityPath(ByVal activity As Activity) As IEnumerable([Of] String)
            Return New <GetActivityPath>d__18(-2) { _
                .<>3__activity = activity _
            }
        End Function

        Private Shared Function GetContainedActivities(ByVal activity As CompositeActivity) As IEnumerable
            Return New <GetContainedActivities>d__0(-2) { _
                .<>3__activity = activity _
            }
        End Function

        Friend Shared Sub GetParameterInfo(ByVal methodInfo As MethodInfo, <Out> ByRef inParameters As List(Of ParameterInfo), <Out> ByRef outParameters As List(Of ParameterInfo))
            inParameters = New List(Of ParameterInfo)
            outParameters = New List(Of ParameterInfo)
            Dim info As ParameterInfo
            For Each info In methodInfo.GetParameters
                If ((info.IsOut OrElse info.IsRetval) OrElse info.ParameterType.IsByRef) Then
                    outParameters.Add(info)
                End If
                If (Not info.IsOut AndAlso Not info.IsRetval) Then
                    inParameters.Add(info)
                End If
            Next
            If (Not methodInfo.ReturnType Is GetType(Void)) Then
                outParameters.Add(methodInfo.ReturnParameter)
            End If
        End Sub

        Friend Shared Function GetPreceedingActivities(ByVal startActivity As Activity) As IEnumerable
            Return WebServiceActivityHelpers.GetPreceedingActivities(startActivity, False)
        End Function

        Friend Shared Function GetPreceedingActivities(ByVal startActivity As Activity, ByVal crossOverLoop As Boolean) As IEnumerable
            Return New <GetPreceedingActivities>d__a(-2) { _
                .<>3__startActivity = startActivity, _
                .<>3__crossOverLoop = crossOverLoop _
            }
        End Function

        Friend Shared Function GetSucceedingActivities(ByVal startActivity As Activity) As IEnumerable
            Return New <GetSucceedingActivities>d__1e(-2) { _
                .<>3__startActivity = startActivity _
            }
        End Function

        Friend Shared Function IsInsideLoop(ByVal webServiceActivity As Activity, ByVal searchBoundary As Activity) As Boolean
            Dim activityPath As IEnumerable(Of String) = WebServiceActivityHelpers.GetActivityPath(searchBoundary)
            Dim dest As IEnumerable(Of String) = WebServiceActivityHelpers.GetActivityPath(webServiceActivity)
            Dim str As String = WebServiceActivityHelpers.FindLeastCommonParent(activityPath, dest)
            Dim activity As Activity = webServiceActivity
            Do While ((Not activity.Parent Is Nothing) AndAlso (activity.Parent.QualifiedName <> str))
                If WebServiceActivityHelpers.IsLoopActivity(activity) Then
                    Return True
                End If
                activity = activity.Parent
            Loop
            Return False
        End Function

        Friend Shared Function IsLoopActivity(ByVal activity As Activity) As Boolean
            Return ((TypeOf activity Is WhileActivity OrElse TypeOf activity Is ReplicatorActivity) OrElse TypeOf activity Is ConditionedActivityGroup)
        End Function

        Friend Shared Function ValidateParameterTypes(ByVal methodInfo As MethodInfo) As ValidationErrorCollection
            Dim errors As New ValidationErrorCollection
            If (Not methodInfo Is Nothing) Then
                Dim info As ParameterInfo
                For Each info In methodInfo.GetParameters
                    If (info.ParameterType Is Nothing) Then
                        errors.Add(New ValidationError(SR.GetString("Error_ParameterTypeNotFound", New Object() { methodInfo.Name, info.Name }), &H571))
                    End If
                Next
                If ((Not methodInfo.ReturnType Is GetType(Void)) AndAlso (methodInfo.ReturnParameter.ParameterType Is Nothing)) Then
                    errors.Add(New ValidationError(SR.GetString("Error_ReturnTypeNotFound", New Object() { methodInfo.Name }), &H572))
                End If
            End If
            Return errors
        End Function


        ' Nested Types
        <CompilerGenerated> _
        Private NotInheritable Class <GetActivityPath>d__18
            Implements IEnumerable(Of String), IEnumerable, IEnumerator(Of String), IEnumerator, IDisposable
            ' Methods
            <DebuggerHidden> _
            Public Sub New(ByVal <>1__state As Integer)
                Me.<>1__state = <>1__state
                Me.<>l__initialThreadId = Thread.CurrentThread.ManagedThreadId
            End Sub

            Private Sub <>m__Finally1b()
                Me.<>1__state = -1
                If (Not Me.<>7__wrap1a Is Nothing) Then
                    Me.<>7__wrap1a.Dispose
                End If
            End Sub

            Private Function MoveNext() As Boolean Implements IEnumerator.MoveNext
                Dim flag As Boolean
                Try 
                    Select Case Me.<>1__state
                        Case 0
                            Me.<>1__state = -1
                            If (Me.activity Is Nothing) Then
                                goto Label_00BD
                            End If
                            Me.<>7__wrap1a = WebServiceActivityHelpers.GetActivityPath(Me.activity.Parent).GetEnumerator
                            Me.<>1__state = 1
                            goto Label_0087
                        Case 2
                            Me.<>1__state = 1
                            goto Label_0087
                        Case 3
                            Me.<>1__state = -1
                            goto Label_00BD
                        Case Else
                            goto Label_00BD
                    End Select
                Label_0058:
                    Me.<path>5__19 = Me.<>7__wrap1a.Current
                    Me.<>2__current = Me.<path>5__19
                    Me.<>1__state = 2
                    Return True
                Label_0087:
                    If Me.<>7__wrap1a.MoveNext Then
                        goto Label_0058
                    End If
                    Me.<>m__Finally1b
                    Me.<>2__current = Me.activity.QualifiedName
                    Me.<>1__state = 3
                    Return True
                Label_00BD:
                    flag = False
                Fault
                    Me.System.IDisposable.Dispose
                End Try
                Return flag
            End Function

            <DebuggerHidden> _
            Private Function System.Collections.Generic.IEnumerable<System.String>.GetEnumerator() As IEnumerator(Of String) Implements IEnumerable(Of String).GetEnumerator
                Dim d__ As <GetActivityPath>d__18
                If ((Thread.CurrentThread.ManagedThreadId = Me.<>l__initialThreadId) AndAlso (Me.<>1__state = -2)) Then
                    Me.<>1__state = 0
                    d__ = Me
                Else
                    d__ = New <GetActivityPath>d__18(0)
                End If
                d__.activity = Me.<>3__activity
                Return d__
            End Function

            <DebuggerHidden> _
            Private Function System.Collections.IEnumerable.GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
                Return Me.System.Collections.Generic.IEnumerable<System.String>.GetEnumerator
            End Function

            <DebuggerHidden> _
            Private Sub System.Collections.IEnumerator.Reset() Implements IEnumerator.Reset
                Throw New NotSupportedException
            End Sub

            Private Sub System.IDisposable.Dispose() Implements IDisposable.Dispose
                Select Case Me.<>1__state
                    Case 1, 2
                        Try 
                        Finally
                            Me.<>m__Finally1b
                        End Try
                        Return
                End Select
            End Sub


            ' Properties
            Private ReadOnly Property System.Collections.Generic.IEnumerator<System.String>.Current As String
                <DebuggerHidden> _
                Get
                    Return Me.<>2__current
                End Get
            End Property

            Private ReadOnly Property System.Collections.IEnumerator.Current As Object
                <DebuggerHidden> _
                Get
                    Return Me.<>2__current
                End Get
            End Property


            ' Fields
            Private <>1__state As Integer
            Private <>2__current As String
            Public <>3__activity As Activity
            Public <>7__wrap1a As IEnumerator(Of String)
            Private <>l__initialThreadId As Integer
            Public <path>5__19 As String
            Public activity As Activity
        End Class

        <CompilerGenerated> _
        Private NotInheritable Class <GetContainedActivities>d__0
            Implements IEnumerable(Of Object), IEnumerable, IEnumerator(Of Object), IEnumerator, IDisposable
            ' Methods
            <DebuggerHidden> _
            Public Sub New(ByVal <>1__state As Integer)
                Me.<>1__state = <>1__state
                Me.<>l__initialThreadId = Thread.CurrentThread.ManagedThreadId
            End Sub

            Private Sub <>m__Finally4()
                Me.<>1__state = -1
                If (Not Me.<>7__wrap3 Is Nothing) Then
                    Me.<>7__wrap3.Dispose
                End If
            End Sub

            Private Sub <>m__Finally7()
                Me.<>1__state = 1
                Me.<>7__wrap6 = TryCast(Me.<>7__wrap5,IDisposable)
                If (Not Me.<>7__wrap6 Is Nothing) Then
                    Me.<>7__wrap6.Dispose
                End If
            End Sub

            Private Function MoveNext() As Boolean Implements IEnumerator.MoveNext
                Dim flag As Boolean
                Try 
                    Select Case Me.<>1__state
                        Case 0
                            Me.<>1__state = -1
                            If Not Me.activity.Enabled Then
                                goto Label_014D
                            End If
                            Me.<>7__wrap3 = Me.activity.Activities.GetEnumerator
                            Me.<>1__state = 1
                            goto Label_0137
                        Case 3
                            goto Label_00F0
                        Case 4
                            Me.<>1__state = 1
                            goto Label_0137
                        Case Else
                            goto Label_014D
                    End Select
                Label_005F:
                    Me.<containedActivity>5__1 = Me.<>7__wrap3.Current
                    If (TypeOf Me.<containedActivity>5__1 Is CompositeActivity AndAlso Not Helpers.IsCustomActivity(DirectCast(Me.<containedActivity>5__1, CompositeActivity))) Then
                        Me.<>7__wrap5 = WebServiceActivityHelpers.GetContainedActivities(DirectCast(Me.<containedActivity>5__1, CompositeActivity)).GetEnumerator
                        Me.<>1__state = 2
                        Do While Me.<>7__wrap5.MoveNext
                            Me.<nestedActivity>5__2 = DirectCast(Me.<>7__wrap5.Current, Activity)
                            If Not Me.<nestedActivity>5__2.Enabled Then
                                Continue Do
                            End If
                            Me.<>2__current = Me.<nestedActivity>5__2
                            Me.<>1__state = 3
                            Return True
                        Label_00F0:
                            Me.<>1__state = 2
                        Loop
                        Me.<>m__Finally7
                    ElseIf Me.<containedActivity>5__1.Enabled Then
                        Me.<>2__current = Me.<containedActivity>5__1
                        Me.<>1__state = 4
                        Return True
                    End If
                Label_0137:
                    If Me.<>7__wrap3.MoveNext Then
                        goto Label_005F
                    End If
                    Me.<>m__Finally4
                Label_014D:
                    flag = False
                Fault
                    Me.System.IDisposable.Dispose
                End Try
                Return flag
            End Function

            <DebuggerHidden> _
            Private Function System.Collections.Generic.IEnumerable<System.Object>.GetEnumerator() As IEnumerator(Of Object) Implements IEnumerable(Of Object).GetEnumerator
                Dim d__ As <GetContainedActivities>d__0
                If ((Thread.CurrentThread.ManagedThreadId = Me.<>l__initialThreadId) AndAlso (Me.<>1__state = -2)) Then
                    Me.<>1__state = 0
                    d__ = Me
                Else
                    d__ = New <GetContainedActivities>d__0(0)
                End If
                d__.activity = Me.<>3__activity
                Return d__
            End Function

            <DebuggerHidden> _
            Private Function System.Collections.IEnumerable.GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
                Return Me.System.Collections.Generic.IEnumerable<System.Object>.GetEnumerator
            End Function

            <DebuggerHidden> _
            Private Sub System.Collections.IEnumerator.Reset() Implements IEnumerator.Reset
                Throw New NotSupportedException
            End Sub

            Private Sub System.IDisposable.Dispose() Implements IDisposable.Dispose
                Select Case Me.<>1__state
                    Case 1, 2, 3, 4
                        Try 
                            Select Case Me.<>1__state
                                Case 2, 3
                                    Try 
                                    Finally
                                        Me.<>m__Finally7
                                    End Try
                                    Exit Select
                            End Select
                        Finally
                            Me.<>m__Finally4
                        End Try
                        Exit Select
                    Case Else
                        Return
                End Select
            End Sub


            ' Properties
            Private ReadOnly Property System.Collections.Generic.IEnumerator<System.Object>.Current As Object
                <DebuggerHidden> _
                Get
                    Return Me.<>2__current
                End Get
            End Property

            Private ReadOnly Property System.Collections.IEnumerator.Current As Object
                <DebuggerHidden> _
                Get
                    Return Me.<>2__current
                End Get
            End Property


            ' Fields
            Private <>1__state As Integer
            Private <>2__current As Object
            Public <>3__activity As CompositeActivity
            Public <>7__wrap3 As IEnumerator(Of Activity)
            Public <>7__wrap5 As IEnumerator
            Public <>7__wrap6 As IDisposable
            Private <>l__initialThreadId As Integer
            Public <containedActivity>5__1 As Activity
            Public <nestedActivity>5__2 As Activity
            Public activity As CompositeActivity
        End Class

        <CompilerGenerated> _
        Private NotInheritable Class <GetPreceedingActivities>d__a
            Implements IEnumerable(Of Object), IEnumerable, IEnumerator(Of Object), IEnumerator, IDisposable
            ' Methods
            <DebuggerHidden> _
            Public Sub New(ByVal <>1__state As Integer)
                Me.<>1__state = <>1__state
                Me.<>l__initialThreadId = Thread.CurrentThread.ManagedThreadId
            End Sub

            Private Sub <>m__Finally12()
                Me.<>1__state = -1
                If (Not Me.<>7__wrap11 Is Nothing) Then
                    Me.<>7__wrap11.Dispose
                End If
            End Sub

            Private Sub <>m__Finally15()
                Me.<>1__state = 1
                Me.<>7__wrap14 = TryCast(Me.<>7__wrap13,IDisposable)
                If (Not Me.<>7__wrap14 Is Nothing) Then
                    Me.<>7__wrap14.Dispose
                End If
            End Sub

            Private Function MoveNext() As Boolean Implements IEnumerator.MoveNext
                Dim flag As Boolean
                Try 
                    Select Case Me.<>1__state
                        Case 0
                            Me.<>1__state = -1
                            Me.<currentActivity>5__b = Nothing
                            Me.<activityStack>5__c = New Stack(Of Activity)
                            Me.<activityStack>5__c.Push(Me.startActivity)
                            goto Label_02F0
                        Case 2
                            goto Label_01BA
                        Case 4
                            goto Label_0270
                        Case 5
                            goto Label_02A3
                        Case Else
                            goto Label_0309
                    End Select
                Label_0059:
                    If (TypeOf Me.<currentActivity>5__b Is CompositeActivity AndAlso Helpers.IsCustomActivity(DirectCast(Me.<currentActivity>5__b, CompositeActivity))) Then
                        goto Label_0309
                    End If
                    If (Not Me.<currentActivity>5__b.Parent Is Nothing) Then
                        Me.<>7__wrap11 = Me.<currentActivity>5__b.Parent.Activities.GetEnumerator
                        Me.<>1__state = 1
                        Do While Me.<>7__wrap11.MoveNext
                            Me.<siblingActivity>5__d = Me.<>7__wrap11.Current
                            If (((Me.<siblingActivity>5__d Is Me.<currentActivity>5__b) AndAlso ((TypeOf Me.<currentActivity>5__b.Parent Is ParallelActivity AndAlso Not Helpers.IsFrameworkActivity(Me.<currentActivity>5__b)) OrElse (TypeOf Me.<currentActivity>5__b.Parent Is StateActivity AndAlso Not Helpers.IsFrameworkActivity(Me.<currentActivity>5__b)))) OrElse ((TypeOf Me.<currentActivity>5__b.Parent Is IfElseActivity AndAlso Not Helpers.IsFrameworkActivity(Me.<currentActivity>5__b)) OrElse (TypeOf Me.<currentActivity>5__b.Parent Is ListenActivity AndAlso Not Helpers.IsFrameworkActivity(Me.<currentActivity>5__b)))) Then
                                Continue Do
                            End If
                            Me.<currentState>5__e = TryCast(Me.<currentActivity>5__b.Parent,StateActivity)
                            If (Me.<currentState>5__e Is Nothing) Then
                                goto Label_01C1
                            End If
                            Me.<enclosingState>5__f = StateMachineHelpers.FindEnclosingState(Me.startActivity)
                            If StateMachineHelpers.IsInitialState(Me.<enclosingState>5__f) Then
                                Me.System.IDisposable.Dispose
                                goto Label_0309
                            End If
                            Me.<>2__current = Me.<currentState>5__e
                            Me.<>1__state = 2
                            Return True
                        Label_01BA:
                            Me.<>1__state = 1
                        Label_01C1:
                            If (Me.<siblingActivity>5__d Is Me.<currentActivity>5__b) Then
                                Exit Do
                            End If
                            If Not Me.<siblingActivity>5__d.Enabled Then
                                Continue Do
                            End If
                            If ((TypeOf Me.<siblingActivity>5__d Is CompositeActivity AndAlso Not Helpers.IsCustomActivity(DirectCast(Me.<siblingActivity>5__d, CompositeActivity))) AndAlso (Me.crossOverLoop OrElse Not WebServiceActivityHelpers.IsLoopActivity(Me.<siblingActivity>5__d))) Then
                                Me.<>7__wrap13 = WebServiceActivityHelpers.GetContainedActivities(DirectCast(Me.<siblingActivity>5__d, CompositeActivity)).GetEnumerator
                                Me.<>1__state = 3
                                Do While Me.<>7__wrap13.MoveNext
                                    Me.<containedActivity>5__10 = DirectCast(Me.<>7__wrap13.Current, Activity)
                                    Me.<>2__current = Me.<containedActivity>5__10
                                    Me.<>1__state = 4
                                    Return True
                                Label_0270:
                                    Me.<>1__state = 3
                                Loop
                                Me.<>m__Finally15
                                Continue Do
                            End If
                            Me.<>2__current = Me.<siblingActivity>5__d
                            Me.<>1__state = 5
                            Return True
                        Label_02A3:
                            Me.<>1__state = 1
                        Loop
                        Me.<>m__Finally12
                    End If
                    If (Not Me.crossOverLoop AndAlso WebServiceActivityHelpers.IsLoopActivity(Me.<currentActivity>5__b.Parent)) Then
                        goto Label_0309
                    End If
                    Me.<activityStack>5__c.Push(Me.<currentActivity>5__b.Parent)
                Label_02F0:
                    If (Not Me.<currentActivity>5__b = Me.<activityStack>5__c.Pop Is Nothing) Then
                        goto Label_0059
                    End If
                Label_0309:
                    flag = False
                Fault
                    Me.System.IDisposable.Dispose
                End Try
                Return flag
            End Function

            <DebuggerHidden> _
            Private Function System.Collections.Generic.IEnumerable<System.Object>.GetEnumerator() As IEnumerator(Of Object) Implements IEnumerable(Of Object).GetEnumerator
                Dim _a As <GetPreceedingActivities>d__a
                If ((Thread.CurrentThread.ManagedThreadId = Me.<>l__initialThreadId) AndAlso (Me.<>1__state = -2)) Then
                    Me.<>1__state = 0
                    _a = Me
                Else
                    _a = New <GetPreceedingActivities>d__a(0)
                End If
                _a.startActivity = Me.<>3__startActivity
                _a.crossOverLoop = Me.<>3__crossOverLoop
                Return _a
            End Function

            <DebuggerHidden> _
            Private Function System.Collections.IEnumerable.GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
                Return Me.System.Collections.Generic.IEnumerable<System.Object>.GetEnumerator
            End Function

            <DebuggerHidden> _
            Private Sub System.Collections.IEnumerator.Reset() Implements IEnumerator.Reset
                Throw New NotSupportedException
            End Sub

            Private Sub System.IDisposable.Dispose() Implements IDisposable.Dispose
                Select Case Me.<>1__state
                    Case 1, 2, 3, 4, 5
                        Try 
                            Select Case Me.<>1__state
                                Case 3, 4
                                    Try 
                                    Finally
                                        Me.<>m__Finally15
                                    End Try
                                    Exit Select
                            End Select
                        Finally
                            Me.<>m__Finally12
                        End Try
                        Exit Select
                    Case Else
                        Return
                End Select
            End Sub


            ' Properties
            Private ReadOnly Property System.Collections.Generic.IEnumerator<System.Object>.Current As Object
                <DebuggerHidden> _
                Get
                    Return Me.<>2__current
                End Get
            End Property

            Private ReadOnly Property System.Collections.IEnumerator.Current As Object
                <DebuggerHidden> _
                Get
                    Return Me.<>2__current
                End Get
            End Property


            ' Fields
            Private <>1__state As Integer
            Private <>2__current As Object
            Public <>3__crossOverLoop As Boolean
            Public <>3__startActivity As Activity
            Public <>7__wrap11 As IEnumerator(Of Activity)
            Public <>7__wrap13 As IEnumerator
            Public <>7__wrap14 As IDisposable
            Private <>l__initialThreadId As Integer
            Public <activityStack>5__c As Stack(Of Activity)
            Public <containedActivity>5__10 As Activity
            Public <currentActivity>5__b As Activity
            Public <currentState>5__e As StateActivity
            Public <enclosingState>5__f As StateActivity
            Public <siblingActivity>5__d As Activity
            Public crossOverLoop As Boolean
            Public startActivity As Activity
        End Class

        <CompilerGenerated> _
        Private NotInheritable Class <GetSucceedingActivities>d__1e
            Implements IEnumerable(Of Object), IEnumerable, IEnumerator(Of Object), IEnumerator, IDisposable
            ' Methods
            <DebuggerHidden> _
            Public Sub New(ByVal <>1__state As Integer)
                Me.<>1__state = <>1__state
                Me.<>l__initialThreadId = Thread.CurrentThread.ManagedThreadId
            End Sub

            Private Sub <>m__Finally25()
                Me.<>1__state = -1
                If (Not Me.<>7__wrap24 Is Nothing) Then
                    Me.<>7__wrap24.Dispose
                End If
            End Sub

            Private Sub <>m__Finally28()
                Me.<>1__state = 1
                Me.<>7__wrap27 = TryCast(Me.<>7__wrap26,IDisposable)
                If (Not Me.<>7__wrap27 Is Nothing) Then
                    Me.<>7__wrap27.Dispose
                End If
            End Sub

            Private Function MoveNext() As Boolean Implements IEnumerator.MoveNext
                Dim flag As Boolean
                Try 
                    Select Case Me.<>1__state
                        Case 0
                            Me.<>1__state = -1
                            Me.<currentActivity>5__1f = Nothing
                            Me.<activityStack>5__20 = New Stack(Of Activity)
                            Me.<activityStack>5__20.Push(Me.startActivity)
                            goto Label_01D7
                        Case 3
                            goto Label_0171
                        Case 4
                            goto Label_01A4
                        Case Else
                            goto Label_01F0
                    End Select
                Label_0055:
                    If (TypeOf Me.<currentActivity>5__1f Is CompositeActivity AndAlso Helpers.IsCustomActivity(DirectCast(Me.<currentActivity>5__1f, CompositeActivity))) Then
                        goto Label_01F0
                    End If
                    If (Not Me.<currentActivity>5__1f.Parent Is Nothing) Then
                        Me.<pastCurrentActivity>5__21 = False
                        Me.<>7__wrap24 = Me.<currentActivity>5__1f.Parent.Activities.GetEnumerator
                        Me.<>1__state = 1
                        Do While Me.<>7__wrap24.MoveNext
                            Me.<siblingActivity>5__22 = Me.<>7__wrap24.Current
                            If (Me.<siblingActivity>5__22 Is Me.<currentActivity>5__1f) Then
                                Me.<pastCurrentActivity>5__21 = True
                                Continue Do
                            End If
                            If (Not Me.<pastCurrentActivity>5__21 OrElse Not Me.<siblingActivity>5__22.Enabled) Then
                                Continue Do
                            End If
                            If (TypeOf Me.<siblingActivity>5__22 Is CompositeActivity AndAlso Not Helpers.IsCustomActivity(DirectCast(Me.<siblingActivity>5__22, CompositeActivity))) Then
                                Me.<>7__wrap26 = WebServiceActivityHelpers.GetContainedActivities(DirectCast(Me.<siblingActivity>5__22, CompositeActivity)).GetEnumerator
                                Me.<>1__state = 2
                                Do While Me.<>7__wrap26.MoveNext
                                    Me.<containedActivity>5__23 = DirectCast(Me.<>7__wrap26.Current, Activity)
                                    Me.<>2__current = Me.<containedActivity>5__23
                                    Me.<>1__state = 3
                                    Return True
                                Label_0171:
                                    Me.<>1__state = 2
                                Loop
                                Me.<>m__Finally28
                                Continue Do
                            End If
                            Me.<>2__current = Me.<siblingActivity>5__22
                            Me.<>1__state = 4
                            Return True
                        Label_01A4:
                            Me.<>1__state = 1
                        Loop
                        Me.<>m__Finally25
                    End If
                    Me.<activityStack>5__20.Push(Me.<currentActivity>5__1f.Parent)
                Label_01D7:
                    If (Not Me.<currentActivity>5__1f = Me.<activityStack>5__20.Pop Is Nothing) Then
                        goto Label_0055
                    End If
                Label_01F0:
                    flag = False
                Fault
                    Me.System.IDisposable.Dispose
                End Try
                Return flag
            End Function

            <DebuggerHidden> _
            Private Function System.Collections.Generic.IEnumerable<System.Object>.GetEnumerator() As IEnumerator(Of Object) Implements IEnumerable(Of Object).GetEnumerator
                Dim d__e As <GetSucceedingActivities>d__1e
                If ((Thread.CurrentThread.ManagedThreadId = Me.<>l__initialThreadId) AndAlso (Me.<>1__state = -2)) Then
                    Me.<>1__state = 0
                    d__e = Me
                Else
                    d__e = New <GetSucceedingActivities>d__1e(0)
                End If
                d__e.startActivity = Me.<>3__startActivity
                Return d__e
            End Function

            <DebuggerHidden> _
            Private Function System.Collections.IEnumerable.GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
                Return Me.System.Collections.Generic.IEnumerable<System.Object>.GetEnumerator
            End Function

            <DebuggerHidden> _
            Private Sub System.Collections.IEnumerator.Reset() Implements IEnumerator.Reset
                Throw New NotSupportedException
            End Sub

            Private Sub System.IDisposable.Dispose() Implements IDisposable.Dispose
                Select Case Me.<>1__state
                    Case 1, 2, 3, 4
                        Try 
                            Select Case Me.<>1__state
                                Case 2, 3
                                    Try 
                                    Finally
                                        Me.<>m__Finally28
                                    End Try
                                    Exit Select
                            End Select
                        Finally
                            Me.<>m__Finally25
                        End Try
                        Exit Select
                    Case Else
                        Return
                End Select
            End Sub


            ' Properties
            Private ReadOnly Property System.Collections.Generic.IEnumerator<System.Object>.Current As Object
                <DebuggerHidden> _
                Get
                    Return Me.<>2__current
                End Get
            End Property

            Private ReadOnly Property System.Collections.IEnumerator.Current As Object
                <DebuggerHidden> _
                Get
                    Return Me.<>2__current
                End Get
            End Property


            ' Fields
            Private <>1__state As Integer
            Private <>2__current As Object
            Public <>3__startActivity As Activity
            Public <>7__wrap24 As IEnumerator(Of Activity)
            Public <>7__wrap26 As IEnumerator
            Public <>7__wrap27 As IDisposable
            Private <>l__initialThreadId As Integer
            Public <activityStack>5__20 As Stack(Of Activity)
            Public <containedActivity>5__23 As Activity
            Public <currentActivity>5__1f As Activity
            Public <pastCurrentActivity>5__21 As Boolean
            Public <siblingActivity>5__22 As Activity
            Public startActivity As Activity
        End Class
    End Class
End Namespace

